home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / mc51bugs / q31779 < prev    next >
Text File  |  1988-07-20  |  2KB  |  60 lines

  1. Q31779 Typedef Signed Char Treated as Unsigned Char with /J
  2. C Compiler
  3. 5.00 5.10
  4. MS-DOS
  5.  
  6. Summary:
  7.    When an item is typedef'ed as signed char, the compiler incorrectly
  8. treats the variable as an unsigned character when compiled with the /J
  9. switch. The /J switch tells the compiler to interpret all characters
  10. that are not explicitly declared as signed as unsigned type.
  11.    Microsoft has confirmed this to be a problem in Version 5.10 of the
  12. C compiler.
  13.    Microsoft is researching this problem and will post new information
  14. as it becomes available.
  15.  
  16. More Information:
  17.    The expected output for the following program is:
  18.  
  19. typedef_signed_char = -1
  20.         signed_char = -1
  21.       unsigned_char = 255
  22.        default_char = 255
  23.  
  24.    However, when compiled with /J, the output is:
  25.  
  26. typedef_signed_char = 255
  27.         signed_char = -1
  28.       unsigned_char = 255
  29.        default_char = 255
  30.  
  31.    The following code example reproduces the problem:
  32.  
  33. #include <stdio.h>
  34. /*
  35.         compile cl -J fooj.c
  36. */
  37.  
  38. typedef signed char FOO;
  39.  
  40. void main(void);
  41.  
  42. void main()
  43. {
  44. FOO           typedef_signed_char = 255;
  45. signed   char         signed_char = 255;
  46. unsigned char       unsigned_char = 255;
  47.          char        default_char = 255;
  48.  
  49. printf( "typedef_signed_char = %ld\n", (long)typedef_signed_char );
  50. printf( "        signed_char = %ld\n", (long)signed_char );
  51. printf( "      unsigned_char = %ld\n", (long)unsigned_char );
  52. printf( "       default_char = %ld\n", (long)default_char );
  53.  
  54.  
  55. } /* main */
  56.  
  57.  
  58. Keywords:  buglist5.10
  59. Updated  88/07/21 03:19
  60.